﻿using System.Collections.Generic;


namespace RoleCustom.ClassD
{
    /// <summary>
    /// 
    /// </summary>
    public class RoleClassDUtils
    {
        /// <summary>
        /// 
        /// </summary>
        public static List<ItemRole> ItemRoleLib { get; private set; }


        /// <summary>
        /// 获取
        /// </summary>
        public static bool TryGet(string userID, out ItemRole output, bool forceCreateIfNotExit = false)
        {
            output = ItemRoleLib.Find(e => e.UserID == userID);
            if (output != null)
                return true;

            if (!forceCreateIfNotExit)
            {
                output = null;
                return false;
            }



            output = new ItemRole();
            {
                output.UserID = userID;
            }

            ItemRoleLib.Add(output);
            return true;
        }


    }
}
